package com.ruoyi.web.controller.article;



import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.weixin.anno.RequireLogin;
import com.ruoyi.weixin.entity.R;
import com.ruoyi.weixin.entity.SgArticle;
import com.ruoyi.weixin.entity.SgLink;
import com.ruoyi.weixin.service.SgLinkService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * 友链(SgLink)表控制层
 *
 * @author makejava
 * @since 2024-01-22 13:47:38
 */
@RequireLogin
@RestController
@RequestMapping("/wexinLogin/sgLink")
public class SgLinkController  {
    /**
     * 服务对象
     */
    @Resource
    private SgLinkService sgLinkService;

    @DataSource(value = DataSourceType.SLAVE)
    @GetMapping
    public R selectAll() {
        return R.ok(sgLinkService.list(new LambdaQueryWrapper<SgLink>().eq(SgLink::getStatus,0)));
    }

    @DataSource(value = DataSourceType.SLAVE)
    @PostMapping("addLient")
    public R addLient(@RequestBody SgLink sgArticle) {
        boolean save = sgLinkService.save(sgArticle);
        return R.ok(save);
    }


}

